feat(ecmascript): PlainTime.prototype.since + until#981
feat(ecmascript): PlainTime.prototype.since + until#9810Zeno wants to merge 1 commit intotrynova:mainfrom
Conversation
| // a. If item has an [[InitializedTemporalTime]] internal slot, then | ||
| if let Ok(time) = TemporalPlainTime::try_from(item) { | ||
| // i. Let resolvedOptions be ? GetOptionsObject(options). | ||
| let resolved_options = get_options_object(agent, options, gc.reborrow()).unbind()?; |
There was a problem hiding this comment.
issue: GC can happen on this line and the line below: that would invalidate time. This shouldn't even pass compilation since item should be correctly bound here.
| // 1. Set other to ? ToTemporalTime(other). | ||
| let other = to_temporal_time(agent, other.unbind(), gc.reborrow()); | ||
| // 2. Let resolvedOptions be ? GetOptionsObject(options). | ||
| let resolved_option = get_options_object(agent, options.get(agent), gc.nogc()) |
There was a problem hiding this comment.
nitpick: You can take options here.
21b0e9e to
1e33056
Compare
| unsafe { | ||
| plain_time = scoped_instant.take(agent); | ||
| // 1. If options is not present, set options to undefined. | ||
| let options = options.unwrap_or(Value::Undefined); |
There was a problem hiding this comment.
issue: Missing bind call here.
| if let Ok(item) = Object::try_from(item) { | ||
| // a. If item has an [[InitializedTemporalTime]] internal slot, then | ||
| if let Ok(time) = TemporalPlainTime::try_from(item) { | ||
| // i. Let resolvedOptions be ? GetOptionsObject(options). |
There was a problem hiding this comment.
issue: time is invalidated by get_temporal_overflow_option call and would need to be scoped to avoid that problem: better choice is to just get the inner_plain_time value out and store it on the stack here at the entry point of this branch, and return it after we've called get_temporal_overflow_option. A temporal_rs::PlainTime on the stack does not care one whit about / cannot be invalidated by GC.
| // a. If item has an [[InitializedTemporalTime]] internal slot, then | ||
| if let Ok(time) = TemporalPlainTime::try_from(item) { | ||
| // i. Let resolvedOptions be ? GetOptionsObject(options). | ||
| let resolved_options = get_options_object(agent, options, gc.nogc()).unbind()?; |
There was a problem hiding this comment.
issue: Missing .bind() call after .unbind()?.
| // d. Let result be ? ToTemporalTimeRecord(item). | ||
| let result = to_temporal_time_record(agent, item.unbind(), gc.reborrow()).unbind()?; | ||
| // e. Let resolvedOptions be ? GetOptionsObject(options). | ||
| let resolved_options = get_options_object(agent, options, gc.nogc()).unbind()?; |
There was a problem hiding this comment.
issue: Missing .bind() call after .unbind()?.
No description provided.